<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>订单管理</title>
<link rel="stylesheet" href="/layui/css/layui.css"></link>
<link rel="stylesheet" href="/css/css.css"></link>
<style>
	.layui-table-body .layui-table-cell{
		height:50px;
		line-height: 50px;
	}
</style>
</head>
<body>


<div style="padding: 20px">
	        <span class="layui-breadcrumb">
			  <a>首页</a>
			  <a><cite>订单管理</cite></a>
			</span>
	<div style="padding-top: 20px;">
		<div style="padding: 20px">
			<div class="layui-form">

				<div class="layui-inline">
					<label class="layui-form-label">订单号：</label>
					<div class="layui-input-inline">
						<input type="text" id="s_orderNo"  placeholder="请输入" autocomplete="off" style="width: 250px" class="layui-input" onkeydown="if(event.keyCode==13) search()"/>
					</div>

				</div>
				<div class="layui-inline">
					<label class="layui-form-label">openid：</label>
					<div class="layui-input-inline">
						<input type="text" id="s_openid"  placeholder="请输入" autocomplete="off" style="width: 250px" class="layui-input" onkeydown="if(event.keyCode==13) search()"/>
					</div>
				</div>


				<div class="layui-inline">
					<button class="layui-btn layuiadmin-btn-list"  lay-submit="" onclick="search()" lay-filter="LAY-app-contlist-search">
						<i class="layui-icon layui-icon-search layuiadmin-button-btn" ></i>
					</button>
				</div>
			</div>
		</div>
		<div>
			<table width="100%" id="orderListTable" ></table>
		</div>
	</div>
</div>

<script src="/layui/layui.js"></script>
<script src="/js/jquery.js"></script>
<script src="/js/common.js"></script>
<script type="text/javascript">

    layui.use(['element','form','table'], function(){
        var form=layui.form;
        var element = layui.element; //导航的hover效果、二级菜单等功能，需要依赖element模块
        $ = layui.jquery; // 使用jquery
        table = layui.table;

        table.render({
            elem: '#orderListTable'
            ,url:'/admin/order/list'
            ,cols: [[
                {type:'checkbox'}
                ,{field:'orderNo', width:150,title: '订单号'}
                ,{field:'userNickName', width:150,title: '用户昵称',templet:formatNickName}
                ,{field:'userUserImage',align:'center', width:100,title: '用户头像',templet:formatImageName}
                ,{field:'userOpenid', title: 'openid',templet:formatOpenId}
                ,{field:'totalAmount', width:100,title: '支付金额',templet:formatTotalAmount}
                ,{field:'buyTime', width:200,title: '购买日期'}
                ,{field:'way',width:100, title: '支付方式'}
                ,{field:'pay', width:100,title: '是否支付？',templet:formatPay}
            ]]
            ,page: true
        });



    });


    function search(){
        var s_openid=$("#s_openid").val();
        var s_orderNo=$("#s_orderNo").val();
        table.reload("orderListTable",{
            page:{
                curr:1
            }
            ,where:{
                openid:s_openid,
                orderNo:s_orderNo
            }
        })
    }



    function formatImageName(d) {
        return "<img width='50' height='50'  src='"+d.user.userImage+"'/>";
    }

    function formatNickName(d) {
        return d.user.nickName;
    }


    function formatOpenId(d) {
        return d.user.openid;
    }

    function formatTotalAmount(d) {
        return d.totalAmount+"元";
    }


    function formatPay(d) {
        if(d.pay){
            return "是";
		}else{
            return "否";
		}
    }



</script>
</body>
</html>